<%--
  Created by IntelliJ IDEA.
  User: WheelChen
  Date: 2017/4/16
  Time: 18:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <link rel="stylesheet" href="../../static/common/layui/css/layui.css">
    <link rel="stylesheet" href="../../static/css/global.css">
    <link rel="stylesheet" href="../../static/css/table.css">
    <script src="../../static/common/ckeditor/ckeditor.js"></script>
    <%--<script type="text/javascript">CKEDITOR.replace('ta_ckeditor');</script>--%>
</head>
<body>
<div>
    <div id="Vue" style="margin: 15px;">
        <!--分页-->
        <div v-show="show" style="display: none">
            <blockquote class="layui-elem-quote">
                <%--<a href="#" class="layui-btn layui-btn-small" @click="add">--%>
                    <%--<i class="layui-icon">&#xe608;</i> 添加--%>
                <%--</a>--%>
                    <a href="#" class="layui-btn layui-btn-small" @click="add">
                       添加
                    </a>
                <%--<a href="#" class="layui-btn layui-btn-small" id="detelBatch">--%>
                <%--<i class="layui-icon">&#x1006;</i> 批量删除--%>
                <%--</a>--%>
                <%--<a href="#" class="layui-btn layui-btn-small" id="edit">--%>
                <%--<i class="layui-icon">&#xe642;</i> 修改--%>
                <%--</a>--%>
                <div style="float: right;">
                    <input id="searchVal">
                    <a href="javascript:;" class="layui-btn layui-btn-small" @click="search">
                        <i class="layui-icon">&#xe615;</i> 查询
                    </a>
                </div>
            </blockquote>
            <fieldset class="layui-elem-field">
                <legend>招聘信息</legend>
                <div class="layui-field-box layui-form">
                    <table class="layui-table admin-table">
                        <thead>
                        <tr>
                            <%--<th style="width: 30px;"><input  type="checkbox" lay-filter="allselector" lay-skin="primary"></th>--%>
                            <th>类型</th>
                            <th>标题</th>
                            <th>岗位类别</th>
                            <th>招聘人数</th>
                            <th>状态</th>
                            <th>发布日期</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <%--内容容器--%>
                        <tbody id="content">
                        </tbody>
                    </table>
                </div>
            </fieldset>
            <%--分页容器--%>
            <div class="admin-table-page">
                <div id="paged" class="page">
                </div>
            </div>
        </div>

        <!--已通过审核或待审核状态下查看-->
        <div v-show="!show" id="view" style="display: none">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend>招聘信息</legend>
            </fieldset>
            <form class="layui-form" >
                <div class="layui-form-item">
                    <label class="layui-form-label">标题</label>
                    <div class="layui-input-inline" style="width: 500px;">
                        <input name="title" class="layui-input" v-model="recruitinfo.title" disabled>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">招聘类别</label>
                    <div class="layui-input-inline">
                        <input name="type" class="layui-input" v-if="recruitinfo.type == 1" value="实习招聘" disabled>
                        <input name="type" class="layui-input" v-if="recruitinfo.type == 2" value="就业招聘" disabled>
                    </div>
                    <label class="layui-form-label">岗位类别</label>
                    <div class="layui-input-inline" v-if="">
                        <input name="positiontype" class="layui-input" v-model="recruitinfo.positiontype" disabled>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">工作城市</label>
                    <div class="layui-input-inline">
                        <input name="workingcity" class="layui-input" v-model="recruitinfo.workingcity" disabled>
                    </div>
                    <label class="layui-form-label">起薪</label>
                    <div class="layui-input-inline">
                        <input name="salaryllimit" class="layui-input" v-model="recruitinfo.salaryllimit" disabled>
                    </div>
                </div>
                <%--<div class="layui-form-item">--%>
                    <%--<label class="layui-form-label">工作内容</label>--%>
                    <%--<div class="layui-input-block">--%>
                        <%--<input name="job" class="layui-input" v-model="recruitinfo.job">--%>
                        <%--&lt;%&ndash;<textarea id="ta_ckeditor" class="ckeditor my-math" cols="20" rows="2" style="overflow:auto"></textarea>&ndash;%&gt;--%>
                    <%--</div>--%>
                <%--</div>--%>
                <div class="layui-form-item">
                    <label class="layui-form-label">工作内容</label>
                    <div class="layui-input-inline">
                        <div name="job" class="layui-textarea"  style="overflow:auto;height: 400px;width:600px;"  id="hello" disabled></div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">其它说明</label>
                    <div class="layui-input-inline">
                        <textarea type="text" name="comment" class="layui-input" v-model="recruitinfo.comment" disabled></textarea>
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">工作环境</label>
                    <div class="layui-input-inline">
                        <img src="" id="showWorkingPic" style="height: 100px;width: 100px">
                        <%--<input type="file" name="fileUp" id="workingpic" class="layui-upload-file">--%>
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">招聘人数</label>
                    <div class="layui-input-inline">
                        <input name="recruitnum" class="layui-input" v-model="recruitinfo.recruitnum" disabled>
                    </div>
                    <label class="layui-form-label">联系人</label>
                    <div class="layui-input-inline">
                        <input name="contactperson" class="layui-input" v-model="recruitinfo.contactperson" disabled>
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">联系电话</label>
                    <div class="layui-input-inline">
                        <input name="phone" class="layui-input" v-model="recruitinfo.phone" disabled>
                    </div>
                    <label class="layui-form-label">联系邮箱</label>
                    <div class="layui-input-inline">
                        <input name="email" class="layui-input" v-model="recruitinfo.email" disabled>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <input type="button" class="layui-btn" @click="reload" value="返回">
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script src="../../static/common/axios.min.js"></script>
<script src="../../static/common/vue.min.js"></script>
<script src="../../static/common/layui/layui.js"></script>
<script src="../../static/common/jquery-3.2.1.js"></script>、
<script type="text/javascript" src="../../static/common/jquery/jquery-1.11.1.min.js"></script>
<script>
    var userId = ${sessionScope.currentUser.getId()};
    var positionTypes = [];//所有岗位信息
    //获取全部岗位信息
    axios.get('/PositionType/findAll')
        .then(function (response) {
            console.log(response.data);
            for (var i = 0; i < response.data.data.length; i++) {
                positionTypes[response.data.data[i].id] = response.data.data[i].typename;
            }
//            console.log(positionTypes);
            //有效岗位类别
            var validPositionTypes = response.data.data;
            console.log(validPositionTypes);
            var html = '';
            for (var i in validPositionTypes) {
                html += '<option value=' + validPositionTypes[i].id + '>' + validPositionTypes[i].typename + '</option>';
            }
            $('select[name=positiontype]').append(html);
        })
        .catch(function (response) {
            console.log(response);
        });
</script>
<!--模板-->
<script type="text/html" id="tpl">
    {{# layui.each(d.data, function(index, item){ }}
    <tr>
        <%--<td><input  type="checkbox" lay-skin="primary"></td>--%>
        <%--招聘类型--%>
        {{# if(item.type == ""){ }}
        <td>-</td>
        {{# }; }}
        {{# if(item.type == 1){ }}
        <td>实习</td>
        {{# }; }}
        {{# if(item.type == 2){ }}
        <td>就业</td>
        {{# }; }}

        <td>{{ item.title || "-" }}</td>
        <td>{{ positionTypes[item.positiontype]}}</td>
        <td>{{ item.recruitnum || "-"}}</td>

        {{# if(item.state == ""){ }}
        <td>-</td>
        {{# }; }}
        {{# if(item.state == 1){ }}
        <td>未提交</td>
        {{# }; }}
        {{# if(item.state == 2){ }}
        <td>待审核</td>
        {{# }; }}
        {{# if(item.state == 3){ }}
        <td>审核通过</td>
        {{# }; }}
        {{# if(item.state == 4){ }}
        <td>审核不通过</td>
        {{# }; }}

        <td>{{ getYearMonthDate(item.publishdate) || "-" }}</td>

        <td>
            {{# if(item.state == 1 || item.state == 4){ }}
            <a href="javascript:;" target="_self" data-id="{{item.id}}" data-opt="edit"
               class="layui-btn layui-btn-normal layui-btn-mini">编辑</a>
            {{# }; }}
            {{# if(item.state == 2 || item.state == 3){ }}
            <a href="javascript:;" target="_self" data-id="{{item.id}}" data-opt="more"
               class="layui-btn layui-btn-mini">查看</a>
            {{# }; }}
            <%--<a href="javascript:;"   data-opt="edit" class9="layui-btn layui-btn-mini">编辑</a>--%>
            <a href="javascript:;" data-opt="delete" data-id="{{item.id}}" class="layui-btn layui-btn-danger layui-btn-mini">删除</a>
        </td>
    </tr>
    {{# }); }}
</script>
<script src="../../static/js/enterprise/recruitInfos.js"></script>
</body>
</html>
